package com.atguigu.juc.day01.lifecycle;

public class DemoDumpThreads {

    public static void main(String[] args) {

        Object lockObj = new Object();

        // RUNNABLE
        new Thread(()->{
            synchronized (lockObj) {
                /*while (true){}*/
            }
        }, "thread-a").start();

        // BLOCKED
        new Thread(()->{
            synchronized (lockObj) {

            }
        }, "thread-b").start();

        // WAITING
        new Thread(()->{
            try {
                synchronized (lockObj) {
                    lockObj.wait();
                }
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }, "thread-c").start();

        // TIMED_WAITING
        new Thread(()->{
            try {
                Thread.sleep(10000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }, "thread-d").start();
        new Thread(()->{
            try {
                synchronized (lockObj) {
                    lockObj.wait(10000);
                }
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }, "thread-e").start();

    }

}
